﻿using System;

namespace _01背包
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] weight = new int[] { 5, 10, 6, 8, 13, 2, 14, 19 };
            int[] value = new int[]  { 6, 18, 6, 2, 14, 3, 12, 12 };
            int W = 50;

            Console.WriteLine("物品重量:" + string.Join(" ", weight));
            Console.WriteLine("物品价值:" + string.Join(" ", value));
            Console.WriteLine("最大负重:" + W);

            Console.WriteLine();
            DateTime start = DateTime.Now;
            Console.WriteLine("求解开始");

            Solution solution = new(weight, value, W);
            int result = solution.Solve();

            Console.WriteLine("最大价值:"+result);

            DateTime end = DateTime.Now;
            Console.WriteLine();
            Console.WriteLine("求解结束");
            Console.WriteLine($"耗时:{(end - start).TotalMilliseconds}毫秒");
        }
    }
}
